package demo;

public class Timer {
    @FunctionalInterface
    public static interface Func {
        void run();
    }
    public static void runWithTimer(Func f, int times) {
        long start = System.currentTimeMillis();
        for (int i =0; i<times; i++) {
            f.run();
        }
        System.out.println("Function ran for" + times + " times in " + (System.currentTimeMillis() - start) + "ms");
    }
}
